<#import "/common/macro/standardLib.ftl" as std />
<div style="text-align:center;">
	<div id="${tableId!}page"></div>
</div>
<!-- 存储分页参数 -->
<div id="${tableId!}pageFrom">
<input type="hidden" name="pageNum"  id="${tableId!}pageNum" />
<input type="hidden" name="numPerPage"  id="${tableId!}numPerPage" />
<input type="hidden" name="totalRecord"  id="${tableId!}totalRecord" />
</div>
<!-- 存储dwz式table隐藏值 -->
<div id="${tableId!}relContentVal">

</div>
<!-- 存储dwz式复选框隐藏值 -->
<div id="${tableId!}relCheckBoxVal">

</div>
<script type="text/html" id="barDemo">
  <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
  <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
</script>
<script>
var flag = true;
layui.use(['laypage','table'], function(){
  var table = layui.table;
  table.defaultDataDeal = '${defaultDataDeal!}';
  var laypage = layui.laypage;
  //渲染数据
   table.render({
	  	id:'${tableId!}'
	  	,method : 'POST'
	  	,elem: '#${tableId!}'
	    ,url:'${dataUrl!}'
	    ,size: 'sm'
	    ,
	    ${height!"height: 'full-250'"}
	    ,cols: [[
	      {type:'checkbox', fixed: 'left'},
	      ${cols!}
	      ,{fixed: 'right', width: 165, align:'center', toolbar: '#barDemo'}
	    ]],
	    page:true,
	    where: {
	    	access_token: layui.data('layuiAdmin').access_token,${where!}
	    }
	     ${extra!}
	  });
	    //监听工具条
	  table.on('tool', function(obj){ //注：tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
	    var data = obj.data //获得当前行数据
	    ,layEvent = obj.event; //获得 lay-event 对应的值
	    if(layEvent === 'detail'){
	      layer.msg('查看操作');
	    } else if(layEvent === 'del'){
	      layer.confirm('真的删除行么', function(index){
	        obj.del(); //删除对应行（tr）的DOM结构
	        layer.close(index);
	        //向服务端发送删除指令
	      });
	    } else if(layEvent === 'edit'){
			layer.open({
	  		    type: 2,
				title:'${formTitle}',
	  		    content: '${formUrl}?recordId='+data.id,
				area: ['90%', '90%'],
	            anim:2
		    });
	    }
	  });
});
</script>
